package com.itic.ht.mem.performance.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itic.appbase.framework.common.constants.DBConst;
import com.itic.appbase.framework.utils.IdGen;
import com.itic.ht.mem.performance.persistence.dao.PerformancedetailDao;
import com.itic.ht.mem.performance.persistence.model.Performancedetail;
import com.itic.ht.mem.performance.persistence.model.PerformancedetailExample;

@Service
@Transactional
public class PerformancedetailService {

	@Autowired
	private PerformancedetailDao performancedetailDao;
	public int count(PerformancedetailExample example) {
		return performancedetailDao.countByExample(example);
	}

	public List<Performancedetail> list(PerformancedetailExample example) {
		return performancedetailDao.selectByExample(example);
	}

	public int add(Performancedetail performancedetail) {
		performancedetail.setCtime(new Date());
		performancedetail.setMtime(new Date());
		performancedetail.setId(IdGen.uuid());
		performancedetail.setEffective(DBConst.TRUE);
		return performancedetailDao.insert(performancedetail);
	}

}
